package com.homework.ch10;

/**
 * @author yuxi
 * @version 1.0
 * @date 2025/10/14
 * @Description:
 */
public class Test5 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            System.out.println("run begin:"+
                    Thread.currentThread().getState());
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                System.out.println(e.getMessage());
                System.out.println("run sleep catch:"+
                        Thread.currentThread().getState());
            }
            for(int i=0;i<1000;i++){
                System.out.println(i*100);
            }
            System.out.println("run end:"+
                    Thread.currentThread().getState());
        });
        System.out.println("new之后"+t.getState());
        t.start();
        System.out.println("start之后："+t.getState());
        Thread.sleep(10);
        System.out.println("start2之后："+t.getState());
        t.interrupt();
        System.out.println("start3之后："+t.getState());
        Thread.sleep(1);
        System.out.println("start4之后："+t.getState());

        t.join();
        System.out.println("t执行完毕后："+t.getState());

    }
}
